import { start } from "nprogress";

let zz = {
  watch: {},
  data(){
    return {
      ziyuankv: {
        'changzhou' : '常州',
        'zhengzhou' : '郑州',
        'erciwang' : '二次网',
        'sanhe' : '三河',
        'hangzhou' : '杭州',
        'linglong' : '玲珑',
        '郑州热力' : '郑州热力',
      }
    }
  },
  methods: {
    ziyuan() {

      this.flyaround()

      let point = [];
      this._earth.sceneTree.root.children.map(item => {
        if (item.title && item.title == "point") {
          point = item.children;
        }
      });

      //mark
      point.map(each_point => {
        each_point.czmObject['scale'] = 1000
        this.mark(each_point.czmObject);
      });

      //odline
      let start = [];
      let end = [];
      point.map(each_point => {
        if (each_point.czmObject.name == "changzhou") {
          end.push(each_point);
        } else {
          start.push(each_point);
        }
      });

      var routePaths = [];
      var timeDuration = 10.0;
      var moveBaseDuration = 4.0;
      start.map(item => {
        routePaths.push({
          startPos: item.czmObject.position,
          endPos: end[0].czmObject.position,
          width: 2.0,
          color: [
            0.8 * Math.random() + 0.2,
            0.5 * Math.random() + 0.5,
            0.1,
            5.0
          ],
          startTime: timeDuration * Math.random(),
          duration: moveBaseDuration + 1.0 * Math.random()
        });
      })

      this.odlines(routePaths);

    }
  }
};

export default zz;
